#include <iostream>
#include <stack>
#include <string>
#include <cstdio>
using namespace std;

typedef enum {
	ERROR_SIGN,
	S_ADD,
	S_SUB,
	S_MUL,
} symbol;

typedef struct {
	bool num;
	union {
		int x;
		symbol y; 
	};
} indentifier;

string s;
int np;
indentifier ind;
bool eos;

symbol conv(char x) {
	switch (x) {
		case '+':
		return S_ADD;
		case '-':
		return S_SUB;
		case '*':
		return S_MUL;
		default :
			return ERROR_SIGN;
	}
}

void scan_num() {
	ind.num = 1;
	ind.x = 0;
	while (1){
		if ('0' <= s[np] && s[np] <= '9') {
			ind.x = ind.x * 10 + s[np] - '0';
			++np;
		} else {
			break;
		}
	}
}

void scan() {
	if (s[np] == '.') ++np;
	switch (s[np]) {
		case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': 
		case '8': case '9': 
			scan_num();
			break;
		case '+': case '-': case '*':
			ind.num = 0;
			ind.y = conv(s[np]);
			++np;
			break;
		case '@':
			eos = 1;
			++np;
			break;
	}
}

void calc(indentifier x, indentifier y, indentifier sym) {
	ind.num = 1;
	switch (sym.y) {
		case S_ADD:
			ind.x = x.x + y.x;
			break;
		case S_SUB:
			ind.x = y.x - x.x;
			break;
		case S_MUL:
			ind.x = x.x * y. x;
			break;
		default:
			break;
	}
	return;
}

int main() {
	stack<indentifier> a;
	getline(cin, s);
	eos = 0;
	while (1) {
		scan();
		if (eos) break;
		if (!ind.num) {
			indentifier sym = ind, x = a.top();
			a.pop();
			indentifier y = a.top();
			a.pop();
			calc(x, y, sym);
			a.push(ind);
		} else {
			a.push(ind);
		}
	}
	indentifier ans = a.top();
	a.pop();
	printf("%d\n", ans.x);
	return 0;
}
